package com.augurit.wf.bi.convert;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.augurit.common.util.lang.DateUtils;
import com.augurit.wf.bi.web.form.WfBusTemplateTypeForm;
import com.augurit.wf.common.entity.WfBusTemplateType;

public class WfBusTemplateTypeConvertor {
	public static WfBusTemplateTypeForm convertVoToForm(WfBusTemplateType entity) {
		if(entity != null) {
			WfBusTemplateTypeForm form = new WfBusTemplateTypeForm();
			form.setId(entity.getId());
			form.setTemplateTypeName(entity.getTemplateTypeName());
			form.setMemo(entity.getMemo());
			return form;
		}else
			return null;
	}
	
	public static void convertFormToVo(WfBusTemplateTypeForm form, WfBusTemplateType entity) {
		if(entity != null && form != null) {
			entity.setId(form.getId());
			if(form.getTemplateTypeName() != null && form.getTemplateTypeName().trim().length() > 0)
				entity.setTemplateTypeName(form.getTemplateTypeName().trim());
			if(form.getMemo() != null && form.getMemo().trim().length() > 0)
				entity.setMemo(form.getMemo().trim());
		}
	}
	
	public static List<WfBusTemplateTypeForm> convertVoListToFormList(List<WfBusTemplateType> wfBusTemplateTypeList) {
		if(wfBusTemplateTypeList != null && wfBusTemplateTypeList.size() > 0) {
			List<WfBusTemplateTypeForm> wfBusTemplateTypeFormList = new ArrayList();
			for(int i=0; i<wfBusTemplateTypeList.size(); i++) {
				wfBusTemplateTypeFormList.add(convertVoToForm(wfBusTemplateTypeList.get(i)));
			}
			return wfBusTemplateTypeFormList;
		}
		return null;
	}

	public static List<WfBusTemplateType> convertFormListToVoList(List<WfBusTemplateTypeForm> wfBusTemplateTypeFormList) {
		if(wfBusTemplateTypeFormList != null && wfBusTemplateTypeFormList.size() > 0) {
			List<WfBusTemplateType> wfBusTemplateTypeList = new ArrayList();
			for(int i=0; i<wfBusTemplateTypeFormList.size(); i++) {
				WfBusTemplateType wfBusTemplateType = new WfBusTemplateType();
				convertFormToVo(wfBusTemplateTypeFormList.get(i), wfBusTemplateType);
				wfBusTemplateTypeList.add(wfBusTemplateType);
			}
			return wfBusTemplateTypeList;
		}
		return null;
	}
}